import 'package:flutter/material.dart';

class CenterBox extends StatelessWidget {
  final String title;
  final String imageUrl;
  final String description;

  const CenterBox({
    super.key,
    required this.title,
    required this.imageUrl,
    required this.description,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      margin: EdgeInsets.all(16),
      height: 280,
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(6),
        image: DecorationImage(
          image: AssetImage(
            'assets/images/home_bg.png',
          ),
          fit: BoxFit.cover,
        ),
      ),
      child:
      //  Stack(
      //   children: [
          Container(
            height: double.infinity,
            width: double.infinity,
            margin: EdgeInsets.all(22),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
              Text(
              '为你推荐', 
              style: TextStyle(
              fontFamily: 'eryazhenyuanjian',
              fontWeight: FontWeight.w900, // 对应于字体的 weight
              fontSize: 20.0,
              color: Colors.white,
              fontStyle: FontStyle.italic,
              textBaseline: TextBaseline.alphabetic,
                ),
              ),
              SizedBox(height: 6),
                Text(
                  '友电之星—开启专属充电之旅！',
                  style: TextStyle(
                    fontSize: 14,
                    fontWeight: FontWeight.w400,
                    color: Colors.white,
                    fontFamily: 'eryazhenyuanjian, eryazhenyuanjian'
                  ),
                ),
                 SizedBox(height: 10),
                 Expanded(
                   child: Container(
                     width: double.infinity,
                     margin: EdgeInsets.only(right: 12),
                     decoration: BoxDecoration(
                       borderRadius: BorderRadius.circular(6),
                       color: Colors.white,
                     ),
                     child: Column(
                       children: [
                        Expanded(
                          child: Container(
                          margin: EdgeInsets.all(12),
                          decoration: BoxDecoration(
                            borderRadius: BorderRadius.circular(6),
                          ),
                          child: ClipRRect(
                            borderRadius: BorderRadius.circular(6),
                            child: Image.network(
                              imageUrl,
                              width: double.infinity,
                              fit: BoxFit.cover,
                            ),
                          ),
                        ),
                        ),

                         Text(
                          title,
                          style: TextStyle(
                            fontSize: 14,
                            fontWeight: FontWeight.bold,
                            color: Colors.black,
                          ),
                          ),
                          SizedBox(height: 12),
                       ],
                     ),
                   ),
                 )
              ],
            ),
          ),
          // Image.asset(imageUrl),
          // Text(title),
          // Text(description),
        //   Positioned(
        //     bottom: 0,
        //     left: 0,
        //     right: 0,
        //     child: Container(
        //       color: Colors.white,
        //     ),
        //   ),
        // ],
      // ),
    );
  }
}

